package org.geotools.tutorial.raster;

import java.io.File;

import org.geotools.swing.data.JFileDataStoreChooser;
import org.geotools.toolbox.Shp2Raster;

public class Shp2RasterTestit {
	// display a data store file chooser dialog for shapefiles
	public static void main(String[] args) throws Exception {
		File file = JFileDataStoreChooser.showOpenFile("shp", null);
		if (file == null) {
			return;
		}
		// to force geotools into using lon/lat order for geographic data
		System.setProperty("org.geotools.referencing.forceXY", "true");
		// /////////////////////////////////////////////////////////////////////
		
		JFileDataStoreChooser chooser = new JFileDataStoreChooser("tif");
		chooser.setDialogTitle("Save result");
		int returnVal = chooser.showSaveDialog(null);
		if (returnVal != JFileDataStoreChooser.APPROVE_OPTION) {
			// the user canceled the dialog
			System.exit(0);
		}
		File outtiff = chooser.getSelectedFile();
		Shp2Raster.execute(file.toString(),"value",200.0,outtiff.toString());
	}

}
